package xyz.jangle.design.singleton;
/**
 * 单例模式，双重检测。
 * @author Administrator
 *
 */
public class SingletonDouble {
	
	private static volatile SingletonDouble uniqueInstance;
	
	private SingletonDouble() {
		System.out.println("单例模式，使用双重检测");
	}
	
	public static SingletonDouble getInstance() {
		if(uniqueInstance==null) {
			synchronized (SingletonDouble.class) {
				if(uniqueInstance==null) {
					uniqueInstance = new SingletonDouble();
				}
			}
		}
		return uniqueInstance;
	}

}
